package cn.iocoder.yudao.framework.validation;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

@Target({
    ElementType.METHOD,
    ElementType.FIELD,
    ElementType.ANNOTATION_TYPE,
    ElementType.CONSTRUCTOR,
    ElementType.PARAMETER,
    ElementType.TYPE_USE
})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(
    validatedBy = {InEnumValueValidator.class, InEnumValueCollectionValidator.class}
)
public @interface InEnumValue {

    /**
     * @return 实现 {@link EnumValuable} 接口的
     */
    Class<? extends EnumValuable> value();

    String message() default "{actual} 无效，只支持 {value}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
